<?php
class Application_Model_CheckAcl extends Zend_Acl {
    
    public function __construct() {
        $this->add(new Zend_Acl_Resource('index'));
        $this->add(new Zend_Acl_Resource('error'));

        $this->add(new Zend_Acl_Resource('book'));
        $this->add(new Zend_Acl_Resource('edit'), 'book');
        $this->add(new Zend_Acl_Resource('add'), 'book');
        $this->add(new Zend_Acl_Resource('delete'), 'book');
		
        $this->add(new Zend_Acl_Resource('agents'));
        $this->add(new Zend_Acl_Resource('login'), 'agents');
        $this->add(new Zend_Acl_Resource('logout'), 'agents');

        $this->add(new Zend_Acl_Resource('jhub1'));
        
        $this->add(new Zend_Acl_Resource('user'));
        
        $this->add(new Zend_Acl_Resource('config'));

        $this->add(new Zend_Acl_Resource('developer'));
        
        $this->add(new Zend_Acl_Resource('hubs'));
        $this->add(new Zend_Acl_Resource('ajax'));
 #       $this->add(new Zend_Acl_Resource('index'), 'hubs');
         
        $this->add(new Zend_Acl_Resource('devices'));
        $this->add(new Zend_Acl_Resource('list'), 'devices');
        
        $this->addRole(new Zend_Acl_Role('guest'));
	$this->addRole(new Zend_Acl_Role('user'), 'guest');
        $this->addRole(new Zend_Acl_Role('admin'), 'user');
        
        $this->allow('guest', 'login');	
	$this->deny('user', 'agents');
        $this->allow('user', array('index', 'devices', 'user', 'hubs'));
        $this->allow('admin', array('index', 'agents', 'devices', 'config', 'jhub1', 'user', 'hubs', 'developer', 'ajax'));
    }
}
?>